import json
import unittest
from pathlib import Path

import ffmpeg
import yt_dlp
from yt_dlp import YoutubeDL

from video_summarize_tools.tools import video_web_page_parser


class LangTest(unittest.TestCase):
    def test_1(self):
        path = video_web_page_parser.download_from_youtube("https://www.youtube.com/shorts/uYmVUdUXtY0")
        print(path)

    def test_ffmpeg_sdk(self):
        p = Path("/home/zst/tmp/unite2.mp4")
        probe = ffmpeg.probe(str(p))
        print(json.dumps(probe))

    def test_ydl_sdk(self):
        ydl = YoutubeDL({})
        info = ydl.extract_info(url = "https://www.youtube.com/watch?v=TeeHyJbUhhM&", download=False)
        format_list = ydl.list_formats(info)
        # print(json.dumps(format_list))
        ydl.build_format_selector()
